<!-- <?xml version="1.0" encoding="UTF-8"?> -->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<ui:component
	xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:a4j="http://richfaces.org/a4j">

	<script
		src="http://www.google.com/jsapi?key=#{googleMapsAction.key}"
		type="text/javascript" />
	<script type="text/javascript">
		google.load("maps", "2.x");
		jQuery(document).ready(function(){
			document.onunload=GUnload;
		});		
		var lastPoint;
	</script>	
	<script type="text/javascript">
	var #{gmapVar} = null;

	function loadGoogleMaps() {
	    #{gmapVar} = new google.maps.Map2(document.getElementById("map"));
            var lng = #{lng != null ? lng : 'null'};
            var lat = #{lat != null ? lat : 'null'};
            var zoom = #{zoom != null ? zoom : 'null'};

	    	if(lng != null){
	    		#{gmapVar}.setCenter(new google.maps.LatLng(lat,lng),zoom);
	    	 	//setMarkerWithIcon(#{gmapVar}, lng, lat);
	    	}else{
	    		lng=16.19384765625;
	    		lat=44.7779358963162;
	    		zoom=7;
	    	}

	    if(#{enableScrollWheelZoom ? true : false}){
	    	#{gmapVar}.enableScrollWheelZoom();
	    }

	    if(#{smallMapControl ? true : false}){
	    	#{gmapVar}.addControl(new google.maps.SmallMapControl());
	    }
	    if(#{largeMapControl ? true : false}){
	    	#{gmapVar}.addControl(new google.maps.LargeMapControl());
	    }
	    if(#{smallZoomControl ? true : false}){
	    	#{gmapVar}.addControl(new google.maps.SmallZoomControl());
	    }
	    if(#{mapTypeControl ? true : false}){
	    	#{gmapVar}.addControl(new google.maps.MapTypeControl());
	    }
	    if(#{scaleControl ? true : false}){
	    	#{gmapVar}.addControl(new google.maps.ScaleControl());
	    }
	    if(#{overviewMapControl ? true : false}){
	    	#{gmapVar}.addControl(new google.maps.OverviewMapControl(new GSize(200,160)));
	    }
	    /*if(#{purpose == 'interactive'?true : false}){
	    	listenMove(#{gmapVar},'includer:s1_form:wizar:longObjektaDecoration:longObjekta','includer:s1_form:wizar:latObjektaDecoration:latObjekta');
			listenClick(#{gmapVar},'includer:s1_form:wizar:longObjektaDecoration:longObjekta','includer:s1_form:wizar:latObjektaDecoration:latObjekta');
			listenZoom(#{gmapVar},'includer:s1_form:wizar:zoomDecoration:zoom');
		}else if(#{purpose == 'group' ? true : false}){
			loadMarkers(#{gmapVar});
		}*/
		loadMap(#{gmapVar});
	}

	google.setOnLoadCallback(loadGoogleMaps);
</script>
<div id="map"  style="width:#{width}px;height:#{height}px;"></div>
</ui:component>